package com.bkhc.umc.repository;


import com.bkhc.common.util.response.ResultJson;
import com.bkhc.umc.vo.ApplyInfomation;
import com.bkhc.umc.vo.Customer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;

@Component
public class BusinessRepository {
    @Autowired
    private RestTemplate restTemplate;

    public ResultJson synCustomeToBusinessApp(Customer customer){
        String serviceName = "BUSINESS-APP";
        String url = "http://" + serviceName + "/business/service/customer/add";
        ResultJson  result = restTemplate.postForObject(url, customer, ResultJson.class);
        return result;
    }

    public ResultJson applyToBeBusiness(ApplyInfomation infomation){
        String serviceName = "BUSINESS-APP";
        String url = "http://" + serviceName + "/business/service/group/applyToBeBusiness";
        ResultJson  result = restTemplate.postForObject(url, infomation, ResultJson.class);
        return result;
    }
}
